Skip to content

Add react-native-test-renderer package#42644

Closed
jackpope wants to merge 2 commits into
facebook:mainfrom
jackpope:test-renderer
Closed

Add react-native-test-renderer package#42644
jackpope wants to merge 2 commits into
facebook:mainfrom
jackpope:test-renderer

Conversation

@jackpope
Copy link
Copy Markdown

Summary:

The goal is to provide testing utilities that use Fabric and concurrent rendering by default to support the new RN architecture. Currently most testing is done through ReactTestRenderer, which is an overly-simplified rendering environment, non-concurrent by default, and over exposes internals. A dedicated RN environment in JS can allow for more realistic test execution.

This is the initial commit to create the react-native-test-renderer package. It currently only offers a simple toJSON() method on the root of a test, which is used for snapshot unit tests. We will be iterating here to add a query interface, event handling, and more.

Changelog:

[GENERAL] [ADDED] - Added react-native-test-renderer package for Fabric rendered integration tests

Test Plan:

$> cd packages/react-native-test-renderer
$> yarn jest

Output:

 PASS  src/renderer/__tests__/render-test.js
  render
    toJSON
      ✓ returns expected JSON output based on renderer component (7 ms)

Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   1 passed, 1 total
Time:        2.869 s

@jackpope jackpope requested a review from rubennorte January 24, 2024 17:33
@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Facebook Partner: Facebook Partner labels Jan 24, 2024
@jackpope jackpope requested a review from sammy-SC January 24, 2024 17:33
@analysis-bot
Copy link
Copy Markdown

analysis-bot commented Jan 24, 2024

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 16,972,296 -94,535
android hermes armeabi-v7a n/a --
android hermes x86 n/a --
android hermes x86_64 n/a --
android jsc arm64-v8a 20,356,074 -94,362
android jsc armeabi-v7a n/a --
android jsc x86 n/a --
android jsc x86_64 n/a --

Base commit: d4c3311
Branch: main

Comment thread jest.config.js
'<rootDir>/packages/react-native/sdks',
'<rootDir>/packages/react-native/Libraries/Renderer',
'<rootDir>/packages/rn-tester/e2e',
'<rootDir>/packages/react-native-test-renderer/src',
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needed to add this because the package has its own jest config and running from root fails. Is there a way to make sure these tests are run against the custom config in CI moving forward?

@NickGerleman
Copy link
Copy Markdown
Contributor

Hey @jackpope, would you be able to import this PR, or remake it in Phabricator?

A couple reasons:

  1. This may end up touching some internal Buck logic, not exposed to the OSS repo
  2. The RN team looks over GitHub, but Phabricator is still the source of truth everything goes through, and will usually get a response faster.
  3. IIRC the robots which notify the RN team of OSS PRs with signed CLA ignore Meta employees
  4. The change will need sign off, other than whoever imports the PR into Phabricator

@facebook-github-bot
Copy link
Copy Markdown
Contributor

@jackpope has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Jan 30, 2024
@facebook-github-bot
Copy link
Copy Markdown
Contributor

@jackpope merged this pull request in c7479b0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants